< previous page page_395 next page >

Page 395
0395-01.gif
Figure 12.16
An object translated to the origin, scaled, and
translated back to its original position.
the object is scaled. You can use a similar technique to reflect an object across an arbitrary line.
Begin by translating the object and the line across which you want to reflect it so that the line passes through the origin. Next, rotate the object and line until the line corresponds to the X axis. Then reflect the object across the X axis. Finally, use the inverses of the original rotation and translation to put the line back in its original position. Figure 12.18 shows an object being reflected across a line.
Rotation around an Arbitrary Point
You can use a similar technique to rotate an object around a point other than the origin. First, translate the point of rotation to the origin. Then rotate the object and use the inverse translation to move the point of rotation back to its original position.
Figure 12.19 shows how to rotate a square around its center. First, translate the square so that its center is at the origin. Then rotate the square using a simple rotation transformation. Finally, translate the square so that its center is back in its original position.
Transformation Matrices in Visual Basic
You can easily write Visual Basic subroutines to make the creation of the simpler transformation matrices easier. The most fundamental of these subroutines initializes an

 
< previous page page_395 next page >